package mybatistestpak;

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import org.apache.commons.io.FileUtils;

import mybatistestpak.utl.ExUtilV2s52;
import mybatistestpak.utl.ResultSetUtil;

public class jdbcTest {

	public static void main(String[] args) throws Exception {
		Connection connection = null;
		Statement statement = null;
		 

		String url ="jdbc:sqlserver://192.168.1.17;databaseName=HealthOne";
		String user = "sa";
		String password = "123456";
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
		} catch (ClassNotFoundException e1) {
			ExUtilV2s52.throwExV2(e1);
		}
		
		
		connection = DriverManager.getConnection(url, user, password);

		Statement preparedStatement = connection.createStatement();// (
																	// request.getParameter("cmdtextbox").toString());
		String f="C:\\0wkspc\\移动医疗源码\\移动医护\\移动医生站\\hodoctor\\src\\mybatistestpak\\sql.txt";
		String sql=FileUtils.readFileToString(new File(f));
		 
			ResultSet rs = preparedStatement.executeQuery(sql);
			;
			List li = ResultSetUtil.toList(rs);
			System.out.println(li);

	}

}
